<template>
  <main class="supplier-system">
    <div class="min-pc-width system">
      <p class="header"><span>第二页</span></p>
      <!-- <a-form :form="form" @submit="handleSubmit"> -->
      <a-form :form="form" @submit="handleSubmit">
        <a-form-item label="计划任务书或者合同书" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['a',{ rules: [{ required: true, message: '本人签字!' }]}]" placeholder="联系电话" autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button class="s-btn">修改</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="工作报告" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['workBook',{ rules: [{ required: true, message: '工作报告!' }]}]"  autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="技术报告（研制报告）" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['b',{ rules: [{ required: true, message: '技术报告!' }]}]" autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="科技查新报告（三年内）有科技项目咨询报告的可一并提供" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['c',{ rules: [{ required: true }]}]"  autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="效益分析证计划任务书或者合同书、协议等" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['d',{ rules: [{ required: true }]}]" autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="工作报告" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['e',{ rules: [{ required: true }]}]" autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="技术报告" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['e',{ rules: [{ required: true }]}]"  autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="科技查新报告（三年内）有科技项目咨询报告的可一并提供" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['f',{ rules: [{ required: true }]}]"  autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item label="效益分析证明（科技成果实践应用效果表）" class="form-item" >
          <a-row :gutter="24">
            <a-col :span="20">
              <a-input v-decorator="['g',{ rules: [{ required: true }]}]"  autocomplete="off" />
            </a-col>
            <a-col :span="4">
              <a-upload name="file" :multiple="true" action="" :headers="headers" >
                <a-button  type="primary" class="s-btn">上传附件</a-button>
              </a-upload>
            </a-col>
          </a-row>
        </a-form-item>
        <div class="supplier-footer">
          <a-button @click="goBack" class="s-btn">
            返回
          </a-button>
          <a-button class="s-btn">
          <!-- <a-button html-type="submit" class="s-btn"> -->
            保存
          </a-button>
          <a-button @click="resetForm" class="s-btn">
            重填
          </a-button>
          <a-button  type="primary" @click="goNext" class="s-btn">
            提交
          </a-button>
        </div>
    </a-form>
    <a-modal
      title=""
      :visible="visible"
      @ok="handleOk"
      cancelText="取消"
      okText="确定"
      @cancel="handleCancel"
    >
      <p>是否确认提交</p>
    </a-modal>
    </div>
  </main>
</template>
<script>
export default {
  data () {
    return {
      currentIndex: 0,
      form: this.$form.createForm(this),
      formId: '',
      formData: ''
    }
  },
  components: {
  },
  computed: {
  },
  created () {
    if (this.$route.query.id) {
      this.formId = this.$route.query.id
      this.getKJCXFormDataById()
    }
  },
  methods: {
    goBack () {
      this.$router.push({ path: `/innovation/supplier/4?id=${this.formId}` })
    },
    goNext () {
      this.$router.push({ path: '/innovation/supplier/4' })
    },
    getKJCXFormDataById () {
      this.$http.getKJCXFormDataById({ id: this.formId }).then(res => {
        this.formData = res.data
      })
    },
    memberStepForm (values) {
      Object.assign(values, this.file, { id: this.formId })
      let _this = this
      this.showDialog({
        title: '提示',
        msg: '确认提交吗',
        lBtnText: '取消',
        rBtnText: '确认',
        confCallBack () {
          _this.$http.submitKJCXForm(values).then(res => {
            _this.$http.submitKejichxinForm({ id: this.formId }).then(res => {
              this.$router.push({ path: '/innovation/supplier/final' })
            })
          })
        }
      })
    },
    handleChange (info, key) {
      if (info.file.status === "done") {
        this.file[key] = info.file.response.fileName
      } else if (info.file.status === "error") {
        this.$message.error(`${info.file.name} file upload failed.`)
      }
    },
    handleSubmit (e) {
      let _this = this
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          _this.memberStepForm(values)
        }
      })
    },
    resetForm () {
      this.form.resetFields()
    }
  }
}
</script>
<style lang="scss">
</style>
